﻿using System.Collections;
using UnityEngine;

public class DeathBringerTeleportState : EnemyState
{
    private Enemy_DeathBringer enemy;
    public DeathBringerTeleportState(EnemyStateMachine _stateMachine, Enemy _enemyBase, string _animBoolName, Enemy_DeathBringer _enemy) : base(_stateMachine, _enemyBase, _animBoolName)
    {
        this.enemy = _enemy;
    }

    public override void Enter()
    {
        base.Enter();

        enemy.Stats.MakeInvincible(true);
        AudioManager.instance.PlaySFX(15, enemy.transform);
    }

    public override void Update()
    {
        base.Update();

        if (triggerCalled)
        {
            if (enemy.CanDoSpellCast())
                stateMachine.ChangeState(enemy.SpellCastState);
            else
                stateMachine.ChangeState(enemy.BattleState);
        }
    }
    public override void Exit()
    {
        base.Exit();

        enemy.Stats.MakeInvincible(false);
        AudioManager.instance.StopSFX(15);
    }
}